@extends('admin.layout.index')


@section('content')
    <div class="col-lg-12">
        <div class="card">
            <div class="card-action">
                友情链接申请列表
            </div>
            <div class="card-content">
                <div class="table">
                    <div id="dataTables-example_wrapper" class="dataTables_wrapper form-inline" role="grid">
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="dataTables_length" id="dataTables-example_length">
                                <form action="/admin/link/index" methot="get">
                                    <label>
                                        <select name="count" aria-controls="dataTables-example" class="form-control input-sm">
                                            <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif>10</option>
                                            <option value="15" @if(!empty($request['count']) && $request['count'] == 15) selected @endif>15</option>
                                            <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
                                            <option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
                                        </select> 请选择要显示的条数
                                    </label>
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div id="dataTables-example_filter" class="dataTables_filter">
                                    <label>搜索:<input name="search" value="{{ $request['search'] or ''}}" class="form-control input-sm" aria-controls="dataTables-example" type="text"></label>
                                    <input type="submit" value="搜索">
                                </div>
                            </form>
                            </div>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
                            <thead>
                                <tr role="row">
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 172px;" aria-sort="ascending" aria-label="Rendering engine: activate to sort column ascending">ID</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 256px;" aria-label="Browser: activate to sort column ascending">手机号</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 256px;" aria-label="Browser: activate to sort column ascending">邮箱</th>

                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 231px;" aria-label="Platform(s): activate to sort column ascending">开通时长</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 144px;" aria-label="Engine version: activate to sort column ascending">链接名</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 144px;" aria-label="Engine version: activate to sort column ascending">连接地址</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">详情</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">操作</th>
                                    <th class="center" tabindex="0" aria-controls="dataTables-example" rowspan="1" colspan="1" style="width: 100px;" aria-label="CSS grade: activate to sort column ascending">状态</th>
                                </tr>
                            </thead>
                            <tbody>
                                    @foreach($data as $k=>$v)
                                    <tr class="gradeA odd">
                                        <td class="center">{{ $v['id'] }}</td>
                                        <td class="center">{{ $v['phone'] }}</td>
                                        <td class="center">{{ $v['email'] }}</td>
                                        <td class="center">{{ $v['timelength'] }}天</td>
                                        @if($v['mode'] == 1)
                                        <td class="center">{{ $v['words'] }}</td>
                                        @elseif($v['mode'] == 2)
                                        <td class="center">
                                            <img src="{{ $v['image'] }}" style='height:30px;width:100px'>
                                        </td>
                                        @endif
                                        <td class="center">{{ $v['url'] }}</td>
                                        <td class="center">
                                            <a href="/admin/link/information/{{ $v['id'] }}" title='详细信息' style="color:#333;font-size:16px"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span></a>
                                        </td>
                                        <td class="center">
                                        @if($v['state'] == 1 || $v['state'] == 2 || $v['state'] == 3)
                                            <a href="/admin/link/edit/{{ $v['id'] }}" title='修改' style="color:#333;font-size:16px"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>
                                        @elseif($v['state'] == 4)
                                            <a href="/admin/link/delete/{{ $v['id'] }}" title='删除' style="color:#333;font-size:17px"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                                        @endif
                                        </td>
                                        <td class="center">
                                            @if($v['state'] == 0)
                                            未处理
                                            @elseif($v['state'] == 1)
                                            <span style="color:green">已同意</span>
                                            @elseif(($v['endtime']-time()) <= 0)
                                            <span style="color:red;size:16px">已到期</span>
                                            @elseif($v['state'] == 2)
                                            <span style="color:blue">关闭</span>
                                            @elseif($v['state'] == 3)
                                            <span style="color:green">开启</span>
                                            @elseif($v['state'] == 4)
                                            <span style="color:red">已拒绝</span>
                                            @endif
                                        </td>
                                    </tr>
                                @endforeach
                            </tbody>
                        </table>
                        <div class="row">
                            <div class="col-sm-6">
                                <div class="dataTables_info" id="dataTables-example_info" role="alert" aria-live="polite" aria-relevant="all">
                                </div>
                            </div>
                            <div class="col-sm-6">
                                <div class="dataTables_paginate paging_simple_numbers" id="dataTables-example_paginate">
                                   <!-- 分页 -->
                                    {!! $data->render() !!}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection